home *** CD-ROM | disk | FTP | other *** search
/ Teach Your Children: Road Construction Ahead / Teach Your Children: Road Construction Ahead.iso / pc / rca / road.dxr / 00016_3D Parent.ls < prev    next >
Encoding:
Text File  |  1996-07-17  |  22.1 KB  |  684 lines

  1. property animChannel, animDataList, tool, machineList, machineNum, firstToolChan, toolList, menuButtonChan, printButChannel, videoList, menuButObject, helpButObject, iconButsObject, toolButtonObjectList, magPictChan, firstMagPict, firstIconChan, firstIconPict, iconPointList, altView, wrenchData, firstMagLinePict, firstRollChan, cropMarksChan, firstCropCast, firstHatChan, musicList, rulerSoundList, keyCoverChan, keyCoverBmap, keyVideoFlag, subSection, machineSoundList, wrenchDelay, delayCounter
  2. global gMenuObject, gActorList, gHiddenActorList, gQTViewerObject, gFlushObject, gRollAnimButton, gCustomCursor, gAlbumObject, gMusicObject, gRotatorObject, gHelpObject, gCDpath, gHardHatObject, gFileSep
  3.  
  4. on birth me
  5.   set subSection to #JobSite
  6.   set firstHatChan to 21
  7.   set firstRollChan to 5
  8.   set cropMarksChan to 30
  9.   set animChannel to 32
  10.   set firstCropCast to the number of cast "frameA"
  11.   set animDataList to [:]
  12.   addProp(animDataList, "Loader", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 19, 18, 17, 16, 21, 22, 0])
  13.   addProp(animDataList, "Digger", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12, 11, 10, 9, 8, 7, 0])
  14.   addProp(animDataList, "Dozer", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 10, 11, 12, 3, 2, 1, 0])
  15.   addProp(animDataList, "Sroller", [0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0])
  16.   addProp(animDataList, "Grader", [0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0])
  17.   addProp(animDataList, "Dumptruk", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 12, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0])
  18.   addProp(animDataList, "Rainbow", [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 7, 6, 5, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 2, 1, 0])
  19.   addProp(animDataList, "Foreman", [0, 1, 2, 2, 2, 2, 3, 4, 5, 6, 7, 8, 7, 8, 9, 10, 11, 0])
  20.   addProp(animDataList, "Sailboat", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
  21.   addProp(animDataList, "Recycle", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1, 0])
  22.   set machineList to ["LOADER": ["0713.MOV", "LOADPOV.MOV", "LOADROT.MOV"], "DIGGER": ["0716.MOV", "EXCAPOV.MOV", "DIGROT.MOV"], "DOZER": ["0714.MOV", "BULLPOV.MOV", "BULLROT.MOV"], "SROLLER": ["0718.MOV", EMPTY, "ROLLROT.MOV"], "GRADER": ["0717.MOV", EMPTY, "GRADROT.MOV"], "DUMPTRUK": ["0715.MOV", EMPTY, "DUMROT.MOV"]]
  23.   set machineSoundList to ["0814N", "0813N", "0816N", "0819N", "0817N", "0815N"]
  24.   set wrenchData to [[10, "0713VO44"], [7, "0716VO44"], [4, "0714VO44"], [5, "0718VO44"], [5, "0717VO44"], [11, "0715VO44"]]
  25.   set wrenchDelay to 7
  26.   set firstMagPict to the number of cast "Loader.Mag"
  27.   set firstIconPict to the number of cast "LoaderIconDim"
  28.   set firstMagLinePict to the number of cast "MagLineArt1"
  29.   set magPictChan to 2
  30.   set firstIconChan to 3
  31.   set iconPointList to [point(597, 22), point(597, 73), point(601, 133), point(603, 184), point(599, 238), point(594, 297)]
  32.   set firstToolChan to 12
  33.   set keyCoverChan to 20
  34.   set keyCoverBmap to the number of cast "KeyCover"
  35.   set menuButtonChan to 27
  36.   set printButChannel to 10
  37.   set toolList to [:]
  38.   addProp(toolList, #magnifier, [0, the number of cast "magnifierCursor"])
  39.   addProp(toolList, #camera, [0, the number of cast "cameraCursor"])
  40.   addProp(toolList, #Tv, [0, the number of cast "tvCursor"])
  41.   addProp(toolList, #Wrench, [0, the number of cast "wrenchCursor"])
  42.   addProp(toolList, #Radio, [0, the number of cast "radioCursor"])
  43.   addProp(toolList, #Ruler, [0, the number of cast "rulerCursor"])
  44.   addProp(toolList, #Rotator, [0, the number of cast "rotatorCursor"])
  45.   addProp(toolList, #Keys, [0, the number of cast "keysCursor"])
  46.   set tool to #None
  47.   set altView to 0
  48.   set musicList to ["0713MU", "0716MU", "0714MU", "0718MU", "0717MU", "0715MU"]
  49.   set rulerSoundList to ["0713VO43", "0716VO43", "0714VO43", "0718VO43", "0717VO43", "0715VO43"]
  50.   return me
  51. end
  52.  
  53. on setup me
  54.   clearAllActors()
  55.   puppetPalette(0)
  56.   drawHardHat(me)
  57.   set magButton to birth(script "Rollover Anim Button Class", "activateTool( g3dObject, #Magnifier )", firstToolChan, firstToolChan, 4, "07VO42", "07RO42")
  58.   set the soundWait of magButton to 0
  59.   setAt(getProp(toolList, #magnifier), 1, magButton)
  60.   set cameraButton to birth(script "Rollover Anim Button Class", "activateTool( g3dObject, #Camera )", firstToolChan + 1, firstToolChan + 1, 5, "07VO41", "07RO41")
  61.   set the soundWait of cameraButton to 0
  62.   setAt(getProp(toolList, #camera), 1, cameraButton)
  63.   set menuButObject to birth(script "Rollover Anim Button Class", "goMenu( g3dObject, me )", menuButtonChan, menuButtonChan, 5, "RCA-07VO01", "RCA-07RO01")
  64.   set helpButObject to birth(script "Rollover Anim Button Class", "help( g3dObject, me )", menuButtonChan + 1, menuButtonChan + 1, 11, EMPTY, "RCA-05RO02")
  65.   set ROsoundObjectList to []
  66.   set hiddenROsounds to ["0727RO", "0725RO", "0723RO", "0722RO"]
  67.   repeat with x = 1 to count(hiddenROsounds)
  68.     add(ROsoundObjectList, birth(script "RolloverSound Class", x, getAt(hiddenROsounds, x)))
  69.   end repeat
  70.   add(gActorList, birth(script "ObjectGroup Class", ROsoundObjectList))
  71.   set ROsoundObjectList to []
  72.   set machROsounds to ["0716RO", "0715RO", "0717RO", "0718RO", "0714RO", "0713RO"]
  73.   repeat with x = 1 to count(machROsounds)
  74.     add(ROsoundObjectList, birth(script "RolloverSound Class", x + 14, getAt(machROsounds, x)))
  75.   end repeat
  76.   add(gActorList, birth(script "ObjectGroup Class", ROsoundObjectList))
  77.   repeat with x = 1 to 2
  78.     set toolData to getAt(toolList, x)
  79.     set toolButObj to getAt(toolData, 1)
  80.     add(gActorList, toolButObj)
  81.   end repeat
  82.   add(gActorList, menuButObject)
  83.   add(gActorList, helpButObject)
  84. end
  85.  
  86. on setupMagScreen me
  87.   clearAllActors()
  88.   add(gActorList, menuButObject)
  89.   add(gActorList, helpButObject)
  90.   puppetSprite(menuButtonChan, 1)
  91.   puppetSprite(menuButtonChan + 1, 1)
  92.   set iconButsObject to birth(script "Rollover Class", firstIconChan, firstIconChan + 5, machineNum)
  93.   set the soundList of iconButsObject to machineSoundList
  94.   set the soundPath of iconButsObject to EMPTY
  95.   set the soundFlag of iconButsObject to 1
  96.   add(gActorList, iconButsObject)
  97.   set tvButton to birth(script "Rollover Anim Button Class", "activateTool( g3dObject, #Tv )", firstToolChan + 2, firstToolChan + 2, 3, "0713VO45", "0713RO45")
  98.   set the soundWait of tvButton to 0
  99.   setAt(getProp(toolList, #Tv), 1, tvButton)
  100.   set wrenchButton to birth(script "Rollover Anim Button Class", "activateTool( g3dObject, #Wrench )", firstToolChan + 3, firstToolChan + 3, 4, "0713VO44", "0713RO44")
  101.   set the soundWait of wrenchButton to 0
  102.   setAt(getProp(toolList, #Wrench), 1, wrenchButton)
  103.   set radioButton to birth(script "Rollover Anim Button Class", "activateTool( g3dObject, #Radio )", firstToolChan + 4, firstToolChan + 4, 3, "A713VO46", "A713RO46")
  104.   set the soundWait of radioButton to 0
  105.   setAt(getProp(toolList, #Radio), 1, radioButton)
  106.   set rulerButton to birth(script "Rollover Anim Button Class", "activateTool( g3dObject, #Ruler )", firstToolChan + 5, firstToolChan + 5, 3, "0713VO43", "0713RO43")
  107.   set the soundWait of rulerButton to 0
  108.   setAt(getProp(toolList, #Ruler), 1, rulerButton)
  109.   set rotatorButton to birth(script "Rollover Anim Button Class", "activateTool( g3dObject, #Rotator )", firstToolChan + 6, firstToolChan + 6, 2, "0713VO47", "0713RO47")
  110.   set the soundWait of rotatorButton to 0
  111.   setAt(getProp(toolList, #Rotator), 1, rotatorButton)
  112.   set keysButton to birth(script "Rollover Anim Button Class", "activateTool( g3dObject, #Keys )", firstToolChan + 7, firstToolChan + 7, 4, "0713VO48", "0713RO48")
  113.   set the soundWait of keysButton to 0
  114.   setAt(getProp(toolList, #Keys), 1, keysButton)
  115.   add(gActorList, birth(script "Rollover Anim Button Class", "print( g3dObject )", 10, 10, 5, "A713VO03", "A713RO03"))
  116.   repeat with x = 3 to count(toolList)
  117.     set toolData to getAt(toolList, x)
  118.     set toolButObj to getAt(toolData, 1)
  119.     add(gActorList, toolButObj)
  120.   end repeat
  121.   if keyVideoFlag = 0 then
  122.     enableKeys(me, 0)
  123.   end if
  124. end
  125.  
  126. on update me
  127.   repeat with whichRoll = 0 to 2
  128.     set rollChan to firstRollChan + whichRoll
  129.     if rollOver(rollChan) then
  130.       set rollFlag to 1
  131.       exit repeat
  132.     end if
  133.   end repeat
  134.   if rollFlag then
  135.     set the locH of sprite cropMarksChan to 320
  136.     set the castNum of sprite cropMarksChan to firstCropCast + whichRoll
  137.     puppetSprite(cropMarksChan, 1)
  138.   else
  139.     puppetSprite(cropMarksChan, 0)
  140.   end if
  141. end
  142.  
  143. on drawHardHat me
  144.   if the howManyHats of gHardHatObject < 100 then
  145.     set hatChan to firstHatChan - 1 + random(4)
  146.     set the locH of sprite hatChan to the locH of sprite hatChan + 1000
  147.     puppetSprite(hatChan, 1)
  148.     puppetTransition(51, 1)
  149.     updateStage()
  150.   end if
  151. end
  152.  
  153. on cameraRectClick me
  154.   if objectp(gCustomCursor) then
  155.     if the type of gCustomCursor = #camera then
  156.       set whichPhoto to the clickOn - firstRollChan + 1
  157.       takePhoto(me, whichPhoto)
  158.     end if
  159.   end if
  160. end
  161.  
  162. on takePhoto me, whichPhoto
  163.   puppetSound("camerashut1")
  164.   updateStage()
  165.   puppetSprite(cropMarksChan, 0)
  166.   set toolData to getProp(toolList, #camera)
  167.   set toolButtonObject to getAt(toolData, 1)
  168.   resetBitmap(toolButtonObject)
  169.   set tool to #None
  170.   cursor(-1)
  171.   dispose(gCustomCursor)
  172.   removeSprite(48)
  173.   set photoName to getPropAt(the pictList of gAlbumObject, whichPhoto)
  174.   addPhoto(gAlbumObject, photoName)
  175.   repeat while soundBusy(1)
  176.   end repeat
  177.   puppetSound(0)
  178.   showAllActors()
  179.   clearActor(me)
  180. end
  181.  
  182. on siteMachineClick me
  183.   startBuffering()
  184.   if not objectp(gRollAnimButton) then
  185.     giveAward(gAwardsObject, "JobSite")
  186.     if objectp(gCustomCursor) then
  187.       if the type of gCustomCursor = #magnifier then
  188.         goMagScreen(me)
  189.       else
  190.         repeat with whichRoll = 0 to 2
  191.           set rollChan to firstRollChan + whichRoll
  192.           if rollOver(rollChan) then
  193.             exit repeat
  194.           end if
  195.         end repeat
  196.         takePhoto(me, whichRoll + 1)
  197.       end if
  198.     else
  199.       set baseCast to the castNum of sprite the clickOn
  200.       puppetSound(the name of cast (baseCast - 1))
  201.       set Xloc to the locH of sprite the clickOn
  202.       set Yloc to the locV of sprite the clickOn
  203.       set the locH of sprite the clickOn to 1000
  204.       run3dAnim(me, baseCast, Xloc, Yloc)
  205.       set the locH of sprite the clickOn to Xloc
  206.       puppetSound(0)
  207.     end if
  208.   end if
  209.   flushBuffer()
  210. end
  211.  
  212. on hiddenItemClick me
  213.   startBuffering()
  214.   if not objectp(gRollAnimButton) and not objectp(gCustomCursor) then
  215.     set baseCast to the castNum of sprite the clickOn + 1
  216.     set the ink of sprite animChannel to 8
  217.     puppetSound(the name of cast (baseCast - 2))
  218.     run3dAnim(me, baseCast, 320, 240)
  219.     set the ink of sprite animChannel to 36
  220.     updateStage()
  221.     repeat while soundBusy(1)
  222.     end repeat
  223.   end if
  224.   flushBuffer()
  225. end
  226.  
  227. on run3dAnim me, baseCast, Xloc, Yloc
  228.   set itemName to the name of cast baseCast
  229.   set the locH of sprite animChannel to Xloc
  230.   set the locV of sprite animChannel to Yloc
  231.   set animList to getProp(animDataList, itemName)
  232.   repeat with offset in animList
  233.     set the castNum of sprite animChannel to baseCast + offset
  234.     updateStage()
  235.     startTimer()
  236.     repeat while the timer < 7
  237.     end repeat
  238.   end repeat
  239.   removeSprite(animChannel)
  240. end
  241.  
  242. on goMagScreen me
  243.   set itemName to the name of cast the castNum of sprite the clickOn
  244.   repeat while soundBusy(1)
  245.   end repeat
  246.   puppetSound(0)
  247.   if objectp(gCustomCursor) then
  248.     dispose(gCustomCursor)
  249.   end if
  250.   cursor(-1)
  251.   clearAllActors()
  252.   unpuppetAll()
  253.   set tool to #None
  254.   set altView to 0
  255.   set machineNum to getPropPos(machineList, itemName)
  256.   puppetPalette("JobSitePal")
  257.   go("Grass")
  258.   go(the frame + 1)
  259.   puppetPalette("MagPal", 60)
  260.   updateStage()
  261.   predraw(me)
  262.   puppetPalette(0)
  263.   go("Magnifier")
  264.   if keyVideoFlag = 0 then
  265.     set subSection to #MagNoKeys
  266.   else
  267.     set subSection to #magnifier
  268.   end if
  269. end
  270.  
  271. on predraw me
  272.   drawMagPict(me)
  273.   set iconChan to firstIconChan + machineNum - 1
  274.   set dimmedIconPict to firstIconPict + ((machineNum - 1) * 3)
  275.   set the castNum of sprite iconChan to dimmedIconPict + 2
  276.   set iconPoint to getAt(iconPointList, machineNum)
  277.   set the locH of sprite iconChan to getAt(iconPoint, 1)
  278.   set the locV of sprite iconChan to getAt(iconPoint, 2)
  279.   puppetSprite(iconChan, 1)
  280.   if the printEnabled of gMenuObject = 0 then
  281.     removeSprite(printButChannel)
  282.     puppetSprite(printButChannel, 1)
  283.   end if
  284.   updateKeyVideoFlag(me)
  285.   if keyVideoFlag = 0 then
  286.     coverKeys(me, 1)
  287.   end if
  288.   puppetSprite(keyCoverChan, 1)
  289. end
  290.  
  291. on enableKeys me, trueOrFalse
  292.   set keyData to getProp(toolList, #Keys)
  293.   set keyObject to getAt(keyData, 1)
  294.   if trueOrFalse = 0 then
  295.     clearActor(keyObject)
  296.   else
  297.     add(gActorList, keyObject)
  298.   end if
  299. end
  300.  
  301. on coverKeys me, trueOrFalse
  302.   set the castNum of sprite keyCoverChan to keyCoverBmap
  303.   puppetSprite(keyCoverChan, 1)
  304.   if trueOrFalse = 1 then
  305.     set the locH of sprite keyCoverChan to 320
  306.     set the locV of sprite keyCoverChan to 240
  307.   else
  308.     set the locH of sprite keyCoverChan to -1000
  309.   end if
  310. end
  311.  
  312. on refreshKeys me
  313.   set oldKeyFlag to keyVideoFlag
  314.   updateKeyVideoFlag(me)
  315.   if (oldKeyFlag = 1) and (keyVideoFlag = 0) then
  316.     enableKeys(me, 0)
  317.     coverKeys(me, 1)
  318.   else
  319.     if (oldKeyFlag = 0) and (keyVideoFlag = 1) then
  320.       enableKeys(me, 1)
  321.       coverKeys(me, 0)
  322.     end if
  323.   end if
  324. end
  325.  
  326. on updateKeyVideoFlag me
  327.   set videoList to getAt(machineList, machineNum)
  328.   if getAt(videoList, 2) = EMPTY then
  329.     set keyVideoFlag to 0
  330.   else
  331.     set keyVideoFlag to 1
  332.   end if
  333. end
  334.  
  335. on drawMagPict me
  336.   set the castNum of sprite magPictChan to firstMagPict + ((machineNum - 1) * 2)
  337.   set the locH of sprite magPictChan to 320
  338.   set the locV of sprite magPictChan to 240
  339.   puppetSprite(magPictChan, 1)
  340. end
  341.  
  342. on runWrenchAnim me
  343.   set delayCounter to 0
  344.   set animData to getAt(wrenchData, machineNum)
  345.   set animLength to getAt(animData, 1)
  346.   set soundName to getAt(animData, 2)
  347.   puppetSprite(magPictChan, 0)
  348.   puppetTransition(51, 1)
  349.   go(label("Wrench" & string(machineNum)))
  350.   preLoad(the frame + 1, the frame + animLength)
  351.   sound playFile 1, gCDpath & "SOUND" & gFileSep & "WRENCH" & gFileSep & soundName
  352.   set the mouseDownScript to "wrenchDone( g3dObject )"
  353. end
  354.  
  355. on wrenchDone me
  356.   startBuffering()
  357.   sound stop 1
  358.   set the mouseDownScript to EMPTY
  359.   set toolData to getProp(toolList, #Wrench)
  360.   set toolButtonObject to getAt(toolData, 1)
  361.   resetBitmap(toolButtonObject)
  362.   set tool to #None
  363.   set altView to 0
  364.   dispose(gCustomCursor)
  365.   removeSprite(48)
  366.   go(label("Wrench" & string(machineNum)))
  367.   puppetSprite(magPictChan, 1)
  368.   go(label("Magnifier") + 1)
  369.   showAllActors()
  370.   flushBuffer()
  371. end
  372.  
  373. on activateTool me, toolSymbol
  374.   startBuffering()
  375.   set toolData to getProp(toolList, toolSymbol)
  376.   set toolButtonObject to getAt(toolData, 1)
  377.   if objectp(gCustomCursor) then
  378.     resetBitmap(toolButtonObject)
  379.     set tool to #None
  380.     dispose(gCustomCursor)
  381.     showAllActors()
  382.     if toolSymbol = #camera then
  383.       clearActor(me)
  384.     end if
  385.   else
  386.     set lastTool to tool
  387.     hideActor(toolButtonObject)
  388.     set toolCursor to getAt(toolData, 2)
  389.     select(toolButtonObject)
  390.     birth(script "ColorCursor Class", toolCursor, toolSymbol)
  391.     add(gActorList, gCustomCursor)
  392.     if toolSymbol = #camera then
  393.       add(gActorList, me)
  394.     end if
  395.     if lastTool = #Rotator then
  396.       set toolData to getProp(toolList, lastTool)
  397.       set toolButtonObject to getAt(toolData, 1)
  398.       resetBitmap(toolButtonObject)
  399.       prepareToLeave(gRotatorObject)
  400.       set the type of sprite magPictChan to 1
  401.       set the ink of sprite magPictChan to 8
  402.       drawMagPict(me)
  403.       puppetTransition(51, 1)
  404.       go(label("Magnifier") + 1)
  405.       if keyVideoFlag = 0 then
  406.         set subSection to #MagNoKeys
  407.       else
  408.         set subSection to #magnifier
  409.       end if
  410.     end if
  411.   end if
  412.   flushBuffer()
  413. end
  414.  
  415. on globalButtonClick me
  416.   if objectp(gCustomCursor) then
  417.     if the type of gCustomCursor = #camera then
  418.       clearActor(me)
  419.     end if
  420.     resetTool(me)
  421.   else
  422.     if objectp(gRollAnimButton) then
  423.       click(gRollAnimButton)
  424.     end if
  425.   end if
  426. end
  427.  
  428. on resetTool me
  429.   set toolType to the type of gCustomCursor
  430.   set toolData to getProp(toolList, toolType)
  431.   set toolButtonObject to getAt(toolData, 1)
  432.   resetBitmap(toolButtonObject)
  433.   showAllActors()
  434.   dispose(gCustomCursor)
  435. end
  436.  
  437. on selectMachine me
  438.   if objectp(gCustomCursor) then
  439.     resetTool(me)
  440.     exit
  441.   else
  442.     if select(iconButsObject) then
  443.       if altView then
  444.         set oldToolData to getProp(toolList, tool)
  445.         set toolButtonObject to getAt(oldToolData, 1)
  446.         resetBitmap(toolButtonObject)
  447.         add(gActorList, toolButtonObject)
  448.         set altView to 0
  449.       end if
  450.       set machineNum to the clickOn - firstIconChan + 1
  451.       refreshKeys(me)
  452.       if keyVideoFlag = 0 then
  453.         set subSection to #MagNoKeys
  454.       else
  455.         set subSection to #magnifier
  456.       end if
  457.       if tool = #Rotator then
  458.         set tool to #None
  459.         prepareToLeave(gRotatorObject)
  460.         set the type of sprite magPictChan to 1
  461.         set the ink of sprite magPictChan to 8
  462.         drawMagPict(me)
  463.         puppetTransition(51, 1)
  464.         go(label("Magnifier") + 1)
  465.         abort()
  466.       else
  467.         drawMagPict(me)
  468.         puppetTransition(51, 1)
  469.         updateStage()
  470.       end if
  471.     end if
  472.   end if
  473. end
  474.  
  475. on magMachineClick me
  476.   startBuffering()
  477.   if objectp(gCustomCursor) then
  478.     set newTool to the type of gCustomCursor
  479.     if altView then
  480.       set oldToolData to getProp(toolList, tool)
  481.       set toolButtonObject to getAt(oldToolData, 1)
  482.       resetBitmap(toolButtonObject)
  483.       add(gActorList, toolButtonObject)
  484.       if tool = #Rotator then
  485.         prepareToLeave(gRotatorObject)
  486.         set the type of sprite magPictChan to 1
  487.         set the ink of sprite magPictChan to 8
  488.       end if
  489.     end if
  490.     if newTool = #Ruler then
  491.       showRulerScreen(me)
  492.     else
  493.       if newTool = #Wrench then
  494.         runWrenchAnim(me)
  495.       else
  496.         if newTool = #Rotator then
  497.           dispose(gCustomCursor)
  498.           puppetSprite(magPictChan, 0)
  499.           set altView to 1
  500.           set machine to getPropAt(machineList, machineNum)
  501.           set videoList to getProp(machineList, machine)
  502.           set the rotatorMovie of gRotatorObject to getAt(videoList, 3)
  503.           set subSection to #Rotator
  504.           go("Rotator")
  505.           showAllActors()
  506.           set toolData to getProp(toolList, newTool)
  507.           set toolButtonObject to getAt(toolData, 1)
  508.           clearActor(toolButtonObject)
  509.           set tool to newTool
  510.         else
  511.           if newTool = #Tv then
  512.             goToVideo(me, #Tv)
  513.           else
  514.             if newTool = #Keys then
  515.               goToVideo(me, #Keys)
  516.             else
  517.               if newTool = #Radio then
  518.                 playMusic(me)
  519.               end if
  520.             end if
  521.           end if
  522.         end if
  523.       end if
  524.     end if
  525.   end if
  526.   flushBuffer()
  527. end
  528.  
  529. on playMusic me
  530.   set altView to 0
  531.   drawMagPict(me)
  532.   puppetTransition(51, 1)
  533.   go(label("Magnifier") + 1)
  534.   set listOfSounds to [getAt(musicList, machineNum)]
  535.   set songPath to gCDpath & "SOUND" & gFileSep & "SONGS" & gFileSep
  536.   set gMusicObject to birth(script "Music Parent", me, listOfSounds, songPath)
  537.   add(gActorList, gMusicObject)
  538.   set the mouseDownScript to "stopSound( g3dObject )"
  539. end
  540.  
  541. on stopSound me
  542.   sound stop 1
  543.   set the mouseDownScript to EMPTY
  544.   clearActor(gMusicObject)
  545.   set gMusicObject to EMPTY
  546.   resetTool(me)
  547.   set tool to #None
  548.   dontPassEvent()
  549. end
  550.  
  551. on showRulerScreen me
  552.   set pictNum to firstMagPict + ((machineNum - 1) * 2) + 1
  553.   puppetSprite(magPictChan, 1)
  554.   set the castNum of sprite magPictChan to pictNum
  555.   set the locH of sprite magPictChan to 320
  556.   set the locV of sprite magPictChan to 240
  557.   puppetTransition(51, 1)
  558.   if tool = #Rotator then
  559.     go(label("Magnifier") + 1)
  560.   else
  561.     go("Ruler")
  562.     set altView to 1
  563.   end if
  564.   set tool to #Ruler
  565.   set the mouseDownScript to "rulerDone( g3dObject )"
  566.   sound playFile 1, gCDpath & "SOUND" & gFileSep & "RULER" & gFileSep & getAt(rulerSoundList, machineNum)
  567. end
  568.  
  569. on rulerDone me
  570.   showAllActors()
  571.   dispose(gCustomCursor)
  572.   set the mouseDownScript to EMPTY
  573.   sound stop 1
  574.   set toolData to getProp(toolList, #Ruler)
  575.   set toolButtonObject to getAt(toolData, 1)
  576.   resetBitmap(toolButtonObject)
  577.   set the castNum of sprite magPictChan to the castNum of sprite magPictChan - 1
  578.   puppetTransition(51, 1)
  579.   go(label("Magnifier") + 1)
  580. end
  581.  
  582. on print me
  583.   clearAllActors()
  584.   unpuppetAll()
  585.   keepSandboxBut(menuButtonChan)
  586.   puppetPalette("MagPal")
  587.   go("Grass")
  588.   go(the frame + 1)
  589.   set the stageColor to 0
  590.   puppetPalette("GrayScenePal", 60)
  591.   updateStage()
  592.   puppetPalette(0)
  593.   unLoadCast()
  594.   set lineArtPict to firstMagLinePict + machineNum - 1
  595.   set the castNum of sprite 7 to lineArtPict
  596.   set the locH of sprite 7 to 320
  597.   set the locV of sprite 7 to 240
  598.   set the ink of sprite 7 to 0
  599.   puppetSprite(7, 1)
  600.   go("MASgray")
  601.   printBitmap(lineArtPict)
  602.   clearAllActors()
  603.   unpuppetAll()
  604.   puppetSprite(48, 1)
  605.   puppetPalette("GrayScenePal")
  606.   go("Grass")
  607.   go(the frame + 1)
  608.   set the stageColor to 255
  609.   unLoadCast()
  610.   predraw(me)
  611.   puppetPalette("MagPal", 60)
  612.   updateStage()
  613.   puppetPalette(0)
  614.   go("Magnifier")
  615.   puppetSprite(48, 0)
  616.   setup(me)
  617.   abort()
  618. end
  619.  
  620. on goToVideo me, tvOrKeys
  621.   set machine to getPropAt(machineList, machineNum)
  622.   set videoList to getProp(machineList, machine)
  623.   if tvOrKeys = #Tv then
  624.     set videoName to getAt(videoList, 1)
  625.     set QTnumber to machineNum
  626.   else
  627.     set videoName to getAt(videoList, 2)
  628.     set QTnumber to machineNum + 6
  629.   end if
  630.   set the videoName of gQTViewerObject to videoName
  631.   set paletteName to the name of cast (the number of cast videoName - 1)
  632.   set the paletteName of gQTViewerObject to paletteName
  633.   set the returnScript of gQTViewerObject to "returnFromQT( g3dObject )"
  634.   cursor(-1)
  635.   dispose(gCustomCursor)
  636.   set tool to #None
  637.   set altView to 0
  638.   removeSprite(48)
  639.   clearAllActors()
  640.   unpuppetAll()
  641.   puppetPalette("MagPal")
  642.   go("Grass")
  643.   go(the frame + 1)
  644.   puppetPalette(paletteName, 60)
  645.   updateStage()
  646.   puppetPalette(0)
  647.   unLoadCast()
  648.   go("QT" & string(QTnumber))
  649. end
  650.  
  651. on returnFromQT me
  652.   prepareToLeave(gQTViewerObject)
  653.   go("Grass")
  654.   unLoadCast()
  655.   go(the frame + 1)
  656.   predraw(me)
  657.   puppetPalette("MagPal", 60)
  658.   updateStage()
  659.   puppetPalette(0)
  660.   go("Magnifier")
  661.   abort()
  662. end
  663.  
  664. on goMenu me, buttonObject
  665.   if objectp(gCustomCursor) then
  666.     dispose(gCustomCursor)
  667.   end if
  668.   cursor(-1)
  669.   clearAllActors()
  670.   unpuppetAll()
  671.   makeButtonJump(buttonObject)
  672.   set tool to #None
  673.   set altView to 0
  674.   puppetPalette(the framePalette)
  675.   go("Grass")
  676.   go(the frame + 1)
  677.   unLoadCast()
  678.   goLocationMap()
  679. end
  680.  
  681. on help me, buttonObject
  682.   birth(script "Help Parent", buttonObject, subSection)
  683. end
  684.